package com.irdstudio.efp.nls.service.impl.sx.zxruleforbd;

import com.irdstudio.cdp.pboc.service.vo.BdZxInfoVO;
import com.irdstudio.efp.rule.service.vo.ReqBdCreditRuleVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.stream.Stream;

/**
 * 贷款当前状态不为“正常”或者“结清” <br>
 * <p>
 * 0.1:caoxin:2019/7/10 17:03: <br>
 * @author caoxin
 * @version 0.1
 * @date 2019/7/10 17:03
 * @since 2019/7/10 17:03
 */
@Service("bDZxRule01")
public class BDZxRule01 implements BdZxRuleInterface {
    @Override
    public void executeRule(ReqBdCreditRuleVo reqBdCreditRuleVo,BdZxInfoVO bdZxInfoVO) {
        Integer sum = Stream.of(bdZxInfoVO.getZxCreCardStatus3()).
                filter(StringUtils::isNotEmpty).
                filter(i -> !StringUtils.equals("正常", i)).
                filter(i -> !StringUtils.equals("结清", i)).
                filter(i -> !StringUtils.equals("-9999", i)).
                map(i -> 1).reduce(0, Integer::sum);
        reqBdCreditRuleVo.setRule01(sum);
    }
}
